package com.gitee.zycra.future.job.common.converter;

import com.gitee.zycra.future.job.common.model.JobRunning;
import com.gitee.zycra.future.job.common.model.JobScheduleLog;

/**
 * @author zycra
 */
public final class JobRunningConverter {

    private JobRunningConverter() {
    }

    public static JobScheduleLog convertToJobScheduleLog(JobRunning jobRunning) {
        if (jobRunning == null) {
            return null;
        }
        return new JobScheduleLog()
                .setId(jobRunning.getId())
                .setJobName(jobRunning.getJobName())
                .setScheduleName(jobRunning.getScheduleName())
                .setJobClassName(jobRunning.getJobClassName())
                .setJobScheduleId(jobRunning.getJobScheduleId())
                .setApplicationName(jobRunning.getApplicationName())
                .setNodeIp(jobRunning.getNodeIp())
                .setScheduleParam(jobRunning.getScheduleParam())
                .setScheduleTime(jobRunning.getScheduleTime())
                .setNormalScheduleTime(jobRunning.getNormalScheduleTime())
                .setRetryTimes(jobRunning.getRetryTimes())
                .setScheduleRatio(jobRunning.getScheduleRatio())
                .setCompleteTime(jobRunning.getCompleteTime());
    }
}
